﻿/*	
	stencil - action script 3 isometric game engine.

	http://code.google.com/p/stencilas3/
	
	Copyright (c) 2010 Max Zhuravkov, All Rights Reserved.

	Permission is hereby granted, free of charge, to any person obtaining a copy of
	this software and associated documentation files (the "Software"), to deal in
	the Software without restriction, including without limitation the rights to
	use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
	of the Software, and to permit persons to whom the Software is furnished to do
	so, subject to the following conditions:

	The above copyright notice and this permission notice shall be included in all
	copies or substantial portions of the Software.

	THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
	IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
	FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
	AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
	LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
	OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
	SOFTWARE.
*/
package stencil.core.ui {
	
	import flash.events.IEventDispatcher;
	
	[Event(name="keyUp",type="flash.events.KeyboardEvent")]
	
	[Event(name="keyDown",type="flash.events.KeyboardEvent")]
	
	/**
	 * This interface defines set of method and properties for handling keyboard input and for indicating its current state.
	 * 
	 * @author Max Zhuravkov
	 */
	public interface IKeyboard extends IEventDispatcher {
		
		/**
		 * Indicates whether Caps Lock key is activated or not.
		 */
		function get capsLock():Boolean;
		
		/**
		 * Indicates whether Num Lock key is activated or not.
		 */
		function get numLock():Boolean;
		
		/**
		 * Indicates whether at least one key is pressed or not.
		 */
		function get anyKeyDown():Boolean;
		
		/**
		 * The array of pressed keycodes. 
		 */
		function get pressedKeyCodes():Array;
		
		/**
		 * Returns true if the given key is down or false otherwise.
		 * 
		 * @param	keyCode		the key code.
		 * 
		 * @return
		 */
		function isKeyDown(keyCode:uint):Boolean;
		
		/**
		 * Returns true when all of the given keys are down and false otherwise.
		 * 
		 * @param	keyCodes	the array of key codes.
		 * 
		 * @return
		 */
		function areKeysDown(keyCodes:Array):Boolean;
		
		/**
		 * Returns true if the given key is currently not pressed.
		 * 
		 * @param	keyCode	the keycode.
		 * 
		 * @return
		 */
		function isKeyUp(keyCode:int):Boolean;
		
		/**
		 * Returns true if the specified key was released since last update and false otherwise.
		 * 
		 * @param	keyCode	the key code.
		 * 
		 * @return
		 */
		function isKeyReleased(keyCode:int):Boolean;
		
		/**
		 * Updates keyboard state.
		 */
		function update():void;
		
		
	}
	
}